// small.cpp : The "smallest ever" windows program.
// A. M. Steane 2007 (and no doubt many others have done it!)
#include <windows.h>
#include "small.h"
BOOL CALLBACK myDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_CLOSE:
EndDialog(hwnd, 0);
return true;
case WM_COMMAND:
if ( LOWORD(wParam) == IDOK ) { EndDialog(hwnd, 0); return true; }
return true;
default:
return false;
}
}
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int nCmdShow)
{
return DialogBox(hInst, MAKEINTRESOURCE(DLG_MAIN), NULL, myDlgProc);
}
//=============================================================================================
// That's all for the program code (small.cpp file)!
// Here follows the single-line "small.h" header file:
#define DLG_MAIN 100
//=============================================================================================
// Here follows the resources file (small.rs):
#include "small.h"
#include "afxres.h"
DLG_MAIN DIALOG DISCARDABLE 50,50, 190,60
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Small progam based on a dialog"
FONT 8, "MS Sans Serif"
{ DEFPUSHBUTTON "OK",IDOK, 129,7,50,14
LTEXT "Hello world",IDC_STATIC, 25,20,80,8
}